package edu.sctu.practice.class02.Wangpeng.Dtest3;

/**
 * Created by wp on 2015/11/30.
 */
public class Actor extends Thread {

    public void run() {
        int count = 0;
        boolean keeprun = true;

        System.out.println(getName()+"开始演出");
        while (keeprun) {
            System.out.println("演出" + (++count));
            if(count==100){
                keeprun=false;
            }
            if(count%10==0){
                try {
                    Thread.sleep(3000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println(getName()+"演出结束");

        }
    }
    public static void main(String[] args) {
        new Actor().setName("王鹏");
        new Actor().start();
        new Thread(new actress()).start();
    }
}

class actress implements Runnable {

    @Override
    public void run() {
        int count = 0;
        boolean keeprun = true;

        System.out.println("开始演出");
        while (keeprun) {
            System.out.println("演出" + (++count));
            if (count == 100) {
                keeprun = false;
            }
            if (count % 10 == 0) {
                try {
                    Thread.sleep(3000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("演出结束");


        }
    }
}